package com.zwx.sortSearch;

/**
 * 合并两个有序数组
 * <p>
 * 给定两个整数数组num1和num2，将num2合并到num1中，得到num1称为一个有序数组
 *
 * @author 文希
 * @create 2019-07-08 22:23
 */
public class Merge2SortArray {

    private static void merge(int[] num1, int m, int[] num2, int n) {
        int l1 = m - 1, l2 = n - 1, len = m + n - 1;
        while (l2 >= 0) {
            num1[len--] = (l1 >= 0 && num1[l1] > num2[l2]) ? num1[l1--] : num2[l2--];
        }
    }
}
